<template>
<div>

  <div class="chain-link-bar-wrapper">
    <el-breadcrumb separator-class="el-icon-arrow-right">
      <el-breadcrumb-item>工厂管理</el-breadcrumb-item>
      <el-breadcrumb-item to="/company/authList">工厂认证列表</el-breadcrumb-item>
      <el-breadcrumb-item :to="'/company/authDetail/' + auth.account_id">详情：{{company.name}}</el-breadcrumb-item>
    </el-breadcrumb>  
  </div>

  <el-card class="box-card">
    
    <div slot="header" class="clearfix">
      <h3 class="app-h3 app-margin-v-0">
        工厂认证详情
      </h3>
    </div>

    <div class="app-diliver-10"></div>
    
    <el-row :gutter="80">
      <el-col :span="12">
        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-v-0">工厂信息</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>

        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">经营地址：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.address}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">联系人：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">
              {{auth.username}}&nbsp;
            </span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">联系方式：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.phone}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">厂家名称：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.company_name}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">注册地址：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.register_address}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">成立日期：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.register_date}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">注册号：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.register_code}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">法人代表：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.legal_person}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">企业类型：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.company_type}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">营业期限：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.business_term}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">登记机关：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.registration}}&nbsp;</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">营业执照：</span>
          </el-col>
          <el-col :span="20">
            <img class="section-img-200" :src="auth.img" />
          </el-col>
      </el-row>
        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-b-0">申请信息</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>
        
        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">申请图片：</span>
          </el-col>
          <el-col :span="20">
            <el-image class="section-img-200" v-if="authImageList != null" v-for="authImage in authImageList" :preview-src-list="authImageList"  :src="authImage" />
            &nbsp;
          </el-col>
        </el-row>
      </el-col>

      <el-col :span="12">
        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-v-0">审核状态</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>
        
        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">状态：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">            
              <el-button v-if="auth.check_status == 'NOT'"  size="mini">未审核</el-button>
              <el-button v-if="auth.check_status == 'ING'" type="primary" size="mini">审核中</el-button>
              <el-button v-if="auth.check_status == 'PASS'" type="success"  size="mini">已通过</el-button>
              <el-button v-if="auth.check_status == 'FAIL'" type="danger"  size="mini">未通过</el-button>&nbsp;
            </span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">审核说明：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.check_status_explain}}&nbsp;</span>
          </el-col>

          <el-col :span="3">
            <span class="app-label">审核时间：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{auth.check_date_time_str}}&nbsp;</span>
          </el-col>
        </el-row>

        <el-row>
          <el-col :span="24">
            <h4 class="app-h4 app-margin-b-0">个人信息 & 公司信息</h4>
          </el-col>
        </el-row>

        <div class="app-diliver-10"></div>

        <el-row class="app-section">
          <el-col :span="3">
            <span class="app-label">发布人：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{account.last_name + account.first_name}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">手机号：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{account.phone}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司名称：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{company.name}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司座机：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">{{company.company_tel == '' ? "暂无座机" : company.company_tel}}</span>
          </el-col>
          <el-col :span="3">
            <span class="app-label">公司地址：</span>
          </el-col>
          <el-col :span="20">
            <span class="app-text">
              {{company.address_detail}}&nbsp;
            </span>
          </el-col>
        </el-row>
      </el-col>

    </el-row>
    
    

  </el-card>

</div>
</template>


<script>

  import NcButton from '../common/NcButton'
  import SubmitButton from '../common/SubmitButton'

  import Api from '../../api/Api'
  import CompanyApi from '../../api/CompanyApi'

  export default {
  	components: {
  		NcButton, SubmitButton
  	},
  	data(){
  	  return {
        
        accountId: 0,
        
        auth: {},
        authImage: {},
        company: {},
        account: {},
  	  }
  	},
  	computed: {
  	  
  	},
  	created(){
  	  this.accountId = this.$route.params.accountId;
      this.getAuthDetail();
  	},
    watch: {
      '$route' (to, from) {
        this.accountId = to.params.accountId;
        this.getAuthDetail();
      }
    },
  	methods: {
      getAuthDetail(){
        CompanyApi.authDetail(this.accountId, json => {
          this.auth = json.auth;
          this.authImageList = json.authImageList;
          this.company = this.auth.company;
          this.account = this.auth.account;
          if (this.authImage == null){
            this.authImage = {};
          }
        });
      }
  	}
  }
</script>

